<?php
class Status extends Controller {
	public function json() {
		$id = $this->post('id', 'int');
		$status = $this->post('status', 'int');
		$act = $this->post('act', 'str');
		
		if(!$id) $this->displayJSON(array('status' => -1, 'message' => '未知景点ID'));
		
		$mProduct = new Product_model();
		
		if($act == 'recommend') $params = array('recommend' => $status);
		else if($act == 'hot') $params = array('hot' => $status);
		else $params = array('status' => $status);
		$result = $mProduct->edit($id, $params);
		if($result) $this->displayJSON(array('status' => 0, 'message' => '更改景点状态成功'));
		else $this->displayJSON(array('status' => -2, 'message' => '更改景点状态失败'));
	}
}